home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 2 / Gold Medal Software Volume 2 (Gold Medal) (1994).iso / os2 / te2_124.arj / TE2SETUP.CMD < prev   
OS/2 REXX Batch file  |  1993-07-21  |  48KB  |  1,551 lines

  1. /* -----------------------------------------------------------------------
  2.  
  3. @echo off
  4. cls
  5. ECHO This INSTALL routine requires that you have OS/2 REXX support installed.
  6. ECHO You should run Selective Installation from the OS/2 Setup Folder to
  7. ECHO install REXX support before attempting to run this CMD file.
  8. PAUSE
  9. EXIT
  10.  
  11.    -----------------------------------------------------------------------
  12.  
  13.      TE2SETUP.CMD -- Oberon Software TE/2 Install and Setup Procedure
  14.                      Copyright (c) 1993 by Oberon Software, Mankato, MN
  15.                      All rights reserved
  16.  
  17.    ----------------------------------------------------------------------- */
  18.  
  19. /* ----------------------------------------------------------------------- */
  20. '@echo off'
  21.  
  22. /* ----------------------------------------------------------------------- */
  23. /* Load REXXUTIL */
  24. call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
  25. call sysloadfuncs
  26.  
  27. /* ----------------------------------------------------------------------- */
  28. /* "Global" variables */
  29.  
  30. CopyRLine0  = 'Oberon Software TE/2 Install and Setup Procedure'
  31. CopyRILine0 = 'Oberon Software TE/2 Install Procedure'
  32. CopyRCLine0 = 'Oberon Software TE/2 Setup Procedure'
  33. CopyRLine1  = 'Copyright (c) 1993 by Oberon Software, Mankato, MN'
  34. CopyRLine2  = 'All rights reserved'
  35.  
  36. SourcePath  = ''
  37. TargetPath  = 'C:\TE2'
  38. TargetPath2 = ''
  39. DLLPath     = ''
  40. INIFileName = 'TE2.INI'
  41. RestorePath = ''
  42.  
  43. SpaceNeeded = 1400000
  44. SpaceAvail  = 0
  45.  
  46. AvailDrives = ''
  47. BootDrive   = ''
  48. LIBSubPath. = ''
  49. DLL16Bit    = 0
  50.  
  51. ProgAction  = '0'
  52. SetupAction = '0'
  53.  
  54. Sensitive.  = ''
  55. Sensitive.0 = 7
  56. Sensitive.1 = 'Te2.Dir'    ; Sensitive.1.Backup = 'Te2Dir.BAK'
  57. Sensitive.2 = 'Te2.Fnk'    ; Sensitive.2.Backup = 'Te2Fnk.BAK'
  58. Sensitive.3 = 'Te2.Ini'    ; Sensitive.3.Backup = 'Te2Ini.BAK'
  59. Sensitive.4 = 'Te2.Xex'    ; Sensitive.4.Backup = 'Te2Xex.BAK'
  60. Sensitive.5 = 'Te2INP.Xlt' ; Sensitive.5.Backup = 'Te2INP.BAK'
  61. Sensitive.6 = 'Te2OUT.Xlt' ; Sensitive.6.Backup = 'Te2OUT.BAK'
  62. Sensitive.7 = 'Modem.Inc'  ; Sensitive.7.Backup = 'Modem.BAK'
  63.  
  64. InstDat01   = 'TE2INST.001'
  65. InstDat02   = 'TE2INST.002'
  66. InstallDone = 0
  67.  
  68. TE2Device   = ''
  69. TE2Modem    = ''
  70. ModemFile.  = ''
  71. ModemSelect = 0
  72.  
  73. INIVar.     = ''
  74. INIVar.0    = 25
  75. INIVar.1    = 'Emulate'        ; INIVar.1.Val  = 'ANSI_TE2'
  76. INIVar.2    = 'LFafterCR'      ; INIVar.2.Val  = 'FALSE'
  77. INIVar.3    = 'LocalEcho'      ; INIVar.3.Val  = 'FALSE'
  78. INIVar.4    = 'ClsReset'       ; INIVar.4.Val  = 'FALSE'
  79. INIVar.5    = 'SwapBS4Del'     ; INIVar.5.Val  = 'FALSE'
  80. INIVar.6    = 'MenuActive'     ; INIVar.6.Val  = 'TRUE'
  81. INIVar.7    = 'DirActive'      ; INIVar.7.Val  = 'FALSE'
  82. INIVar.8    = 'Scrollback'     ; INIVar.8.Val  = '512'
  83. INIVar.9    = 'LogoDelay'      ; INIVar.9.Val  = '8'
  84. INIVar.10   = 'AutoDirSave'    ; INIVar.10.Val = 'TRUE'
  85. INIVar.11   = 'DialerTimeOut'  ; INIVar.11.Val = '45'
  86. INIVar.12   = 'RedialDelay'    ; INIVar.12.Val = '2'
  87. INIVar.13   = 'DialerSendInit' ; INIVar.13.Val = 'FALSE'
  88. INIVar.14   = 'DownloadPath'   ; INIVar.14.Val = ''
  89. INIVar.15   = 'UploadPath'     ; INIVar.15.Val = ''
  90. INIVar.16   = 'DLPrtyClass'    ; INIVar.16.Val = 'FIXEDHIGH'
  91. INIVar.17   = 'ULPrtyClass'    ; INIVar.17.Val = 'FIXEDHIGH'
  92. INIVar.18   = 'AutoZM'         ; INIVar.18.Val = 'TRUE'
  93. INIVar.19   = 'ClobberDL'      ; INIVar.19.Val = 'SALVAGE'
  94. INIVar.20   = 'DirFile'        ; INIVar.20.Val = 'Te2.Dir'
  95. INIVar.21   = 'FnkFile'        ; INIVar.21.Val = 'Te2.Fnk'
  96. INIVar.22   = 'XexFile'        ; INIVar.22.Val = 'Te2.Xex'
  97. INIVar.23   = 'CallLog'        ; INIVar.23.Val = ''
  98. INIVar.24   = 'SnapShot'       ; INIVar.24.Val = 'Te2Snap.Sht'
  99. INIVar.25   = 'LogPath'        ; INIVar.25.Val = ''
  100.  
  101. AvailDrives = SysDriveMap('A:', 'USED')
  102.  
  103. do forever
  104.   call SelectAction
  105.   select
  106.     when ProgAction = '0' then leave
  107.     when ProgAction = '1' then call Install
  108.     when ProgAction = '2' then call Configure
  109.   end
  110. end
  111.  
  112. call SysCls
  113. say 'Oberon Software TE/2 INSTALL and SETUP Ended!'
  114. say ''
  115. say '  Oberon Software'
  116. say '  518 Blue Earth St.'
  117. say '  Mankato, MN 56001-2142'
  118. say '  1-507-388-7001'
  119. say ''
  120. Exit 0
  121.  
  122.  
  123. /* ----------------------------------------------------------------------- */
  124.  
  125. SelectAction:
  126.   call PutCopyright 'Full'
  127.   say ''
  128.   say 'Select one of the following:'
  129.   say ''
  130.   say ''
  131.   say '       1. Install TE/2 onto your hard disk.'
  132.   say '       2. Configure your installed TE/2'
  133.   say '       0. Exit this program'
  134.   say ''
  135.   say ''
  136.   call charout ,'Enter 0, 1, or 2: '
  137.   do forever
  138.     k = SysGetKey('NOECHO')
  139.     if k = '0' | k = '1' | k = '2' | k = D2C(27) then
  140.       do
  141.         if k = D2C(27) then k = '0'
  142.         say k
  143.         ProgAction = k
  144.         leave
  145.       end
  146.     else
  147.       call beep 1760, 50
  148.   end
  149.   return
  150.  
  151. /* ----------------------------------------------------------------------- */
  152.  
  153. Install:
  154.   if BootDrive = '' then
  155.     do
  156.       call GetBootDrive
  157.       if result = 0 then return
  158.     end
  159.   if SourcePath = '' then
  160.     do
  161.       parse source . . argv0 .
  162.       temp = reverse(argv0)
  163.       temp = substr(temp, pos('\', temp))
  164.       if length(temp) > 3 then temp = substr(temp, 2)
  165.       SourcePath = reverse(temp)
  166.     end
  167.  
  168.   do forever
  169.     parse value SysDriveInfo(substr(TargetPath, 1, 2)) with dummy SpaceAvail dummy2
  170.     if DLLPath = '*Program Directory*' then
  171.       tempDLLPath = TargetPath
  172.     else
  173.       tempDLLPath = DLLPath
  174.     if DLL16Bit = 0 then
  175.       tempDLL16 = '32-bit'
  176.     else
  177.       tempDLL16 = '16-bit'
  178.     InstallDone = 0
  179.     call PutCopyright 'Install'
  180.     say ''
  181.     say 'Select one of the following:'
  182.     say ''
  183.     say ''
  184.     say '       1. Select SOURCE Path      (Current is:' SourcePath')'
  185.     say '       2. Select TARGET Path      (Current is:' TargetPath')'
  186.     say '       3. Select DLL    Path      (Current is:' tempDLLPath')'
  187.     say '       4. Select 16 or 32-bit DLL (Current is:' tempDLL16')'
  188.     say '       5. Install TE/2'
  189.     say '       0. Quit Install Procedure'
  190.     say ''
  191.     say ''
  192.     if SpaceAvail < SpaceNeeded then
  193.       say 'NOTE: Installation requires' SpaceNeeded 'bytes on target drive, only' SpaceAvail 'available!.'
  194.     call charout ,'Enter 0, 1, 2, 3, 4, or 5: '
  195.     do forever
  196.       k = SysGetKey('NOECHO')
  197.       if k = '0' | k = '1' | k = '2' | k = '3' | k = '4' | k = '5' | k = D2C(27) then
  198.         do
  199.           if k = D2C(27) then k = '0'
  200.           say k
  201.           ProgAction = k
  202.           leave
  203.         end
  204.       else
  205.         call beep 1760, 50
  206.     end
  207.     select
  208.       when ProgAction = '0' then leave
  209.       when ProgAction = '1' then call AskPath 'SOURCE'
  210.       when ProgAction = '2' then call AskPath 'TARGET'
  211.       when ProgAction = '3' then call AskLIBPath
  212.       when ProgAction = '4' then call AskDLL16
  213.       when ProgAction = '5' then call DoInstall
  214.     end
  215.     if InstallDone \= 0 then leave
  216.   end
  217.   return
  218.  
  219.  
  220. /* ----------------------------------------------------------------------- */
  221.  
  222. Configure:
  223.   call CheckINIFile
  224.   if result = 0 then return
  225.   call GetINISettings
  226.   do forever
  227.     call PutCopyright 'Setup'
  228.     say 'Note: "Modem Setup" and "Color" changes take effect immediately, for all'
  229.     say '      others, you will be prompted whether to save on exit.'
  230.     say ''
  231.     say '  File:' INIFileName
  232.     say ''
  233.     say '    1. Select COM Device  (Current:' TE2Device')'
  234.     say '    2. Select Modem Setup (Current:' TE2Modem')'
  235.     say '    3. Terminal Settings'
  236.     say '    4. Dialer Settings'
  237.     say '    5. Protocol Settings'
  238.     say '    6. File and Path Settings'
  239.     say '    7. Colors'
  240.     say '    0. Exit Setup'
  241.     say ''
  242.     say ''
  243.     call charout ,'Enter 0, 1, 2, 3, 4, 5, 6, or 7: '
  244.     do forever
  245.       k = SysGetKey('NOECHO')
  246.       if k = '0' | k = '1' | k = '2' | k = '3' | k = '4' | k = '5' | k = '6' | k = '7' | k = D2C(27) then
  247.         do
  248.           if k = D2C(27) then k = '0'
  249.           say k
  250.           SetupAction = k
  251.           leave
  252.         end
  253.       else
  254.         call beep 1760, 50
  255.     end
  256.     select
  257.       when SetupAction = '0' then leave
  258.       when SetupAction = '1' then call SelectDevice
  259.       when SetupAction = '2' then call SelectModem
  260.       when SetupAction = '3' then call TermSettings
  261.       when SetupAction = '4' then call DialerSettings
  262.       when SetupAction = '5' then call ProtoSettings
  263.       when SetupAction = '6' then call MiscSettings
  264.       when SetupAction = '7' then call SetupColors
  265.     end
  266.   end
  267.  
  268.   say ''
  269.   call GetYN 'Save changes to the file?'
  270.   if result = 1 then call SaveINIFile
  271.  
  272.   if RestorePath \= '' then call directory RestorePath
  273.   return
  274.  
  275. /* ----------------------------------------------------------------------- */
  276.  
  277. TermSettings:
  278.   do forever
  279.     call PutCopyright 'Setup'
  280.     say '    1. Default Emulation           ('INIVar.1.Val')'
  281.     say '    2. LF/CRLF Conversion          ('INIVar.2.Val')'
  282.     say '    3. Local Echo                  ('INIVar.3.Val')'
  283.     say '    4. CLS Resets Term Color       ('INIVar.4.Val')'
  284.     say '    5. Backspace->DEL Conversion   ('INIVar.5.Val')'
  285.     say '    6. Menu Initially Visible      ('INIVar.6.Val')'
  286.     say '    7. Directory Initially Visible ('INIVar.7.Val')'
  287.     say '    8. Scroll Back Lines           ('INIVar.8.Val')'
  288.     say '    9. Logo Delay                  ('INIVar.9.Val')'
  289.     say '    0. Exit Terminal Settings'
  290.     say ''
  291.     say ''
  292.     call charout ,'Enter 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9: '
  293.     do forever
  294.       k = SysGetKey('NOECHO')
  295.       if k = '0' | k = '1' | k = '2' | k = '3' | k = '4' | k = '5' | k = '6' | k = '7' | k = '8' | k = '9' | k = D2C(27) then
  296.         do
  297.           if k = D2C(27) then k = '0'
  298.           say k
  299.           TermAction = k
  300.           leave
  301.         end
  302.       else
  303.         call beep 1760, 50
  304.     end
  305.     select
  306.       when TermAction = '0' then leave
  307.       when TermAction = '1' then
  308.         do
  309.           call PutCopyright 'Setup'
  310.           say 'Default Emulation Mode (Current is:' INIVar.1.Val')'
  311.           say ''
  312.           say '    1. TTY'
  313.           say '    2. ANSI_TE2'
  314.           say '    3. ANSI'
  315.           say '    4. VT100'
  316.           say '    5. 3101'
  317.           say '    0. No change'
  318.           say ''
  319.           say ''
  320.           call charout ,'Enter 0, 1, 2, 3, 4, or 5: '
  321.           do forever
  322.             k = SysGetKey('NOECHO')
  323.             if k = '0' | k = '1' | k = '2' | k = '3' | k = '4' | k = '5' | k = D2C(27) then
  324.               do
  325.                 if k = D2C(27) then k = '0'
  326.                 say k
  327.                 TermAction1 = k
  328.                 leave
  329.               end
  330.             else
  331.               call beep 1760, 50
  332.           end
  333.           select
  334.             when TermAction1 = '1' then INIVar.1.Val = 'TTY'
  335.             when TermAction1 = '2' then INIVar.1.Val = 'ANSI_TE2'
  336.             when TermAction1 = '3' then INIVar.1.Val = 'ANSI'
  337.             when TermAction1 = '4' then INIVar.1.Val = 'VT100'
  338.             when TermAction1 = '5' then INIVar.1.Val = '3101'
  339.             otherwise nop
  340.           end
  341.         end
  342.       when TermAction = '8' then
  343.         do
  344.           call AskNumber 0, 32767, 'Scroll Back Lines'
  345.           if result \= '' then INIVar.8.Val = result
  346.         end
  347.       when TermAction = '9' then
  348.         do
  349.           call AskNumber 0, 32767, 'Logo Delay'
  350.           if result \= '' then INIVar.9.Val = result
  351.         end
  352.       otherwise
  353.         do
  354.           ta = TermAction
  355.           if INIVar.ta.Val = 'TRUE' then
  356.             INIVar.ta.Val = 'FALSE'
  357.           else
  358.             INIVar.ta.Val = 'TRUE'
  359.         end
  360.     end
  361.   end
  362.   return
  363.  
  364. /* ----------------------------------------------------------------------- */
  365.  
  366. DialerSettings:
  367.   do forever
  368.     call PutCopyright 'Setup'
  369.     say '    1. Auto Save Directory File    ('INIVar.10.Val')'
  370.     say '    2. Dialer Timeout              ('INIVar.11.Val')'
  371.     say '    3. Redial Delay                ('INIVar.12.Val')'
  372.     say '    4. Dialer Sends Modem Init     ('INIVar.13.Val')'
  373.     say '    0. Exit Dialer Settings'
  374.     say ''
  375.     call charout ,'Enter 0, 1, 2, 3, or 4: '
  376.     do forever
  377.       k = SysGetKey('NOECHO')
  378.       if k = '0' | k = '1' | k = '2' | k = '3' | k = '4' | k = D2C(27) then
  379.         do
  380.           if k = D2C(27) then k = '0'
  381.           say k
  382.           DialAction = k
  383.           leave
  384.         end
  385.       else
  386.         call beep 1760, 50
  387.     end
  388.     select
  389.       when DialAction = '0' then leave
  390.       when DialAction = '2' then
  391.         do
  392.           call AskNumber 1, 32767, 'Dialer Timeout'
  393.           if result \= '' then INIVar.11.Val = result
  394.         end
  395.       when DialAction = '3' then
  396.         do
  397.           call AskNumber 1, 32767, 'Redial Delay'
  398.           if result \= '' then INIVar.12.Val = result
  399.         end
  400.       otherwise
  401.         do
  402.           da = DialAction + 9
  403.           if INIVar.da.Val = 'TRUE' then
  404.             INIVar.da.Val = 'FALSE'
  405.           else
  406.             INIVar.da.Val = 'TRUE'
  407.         end
  408.     end
  409.   end
  410.   return
  411.  
  412. /* ----------------------------------------------------------------------- */
  413.  
  414. ProtoSettings:
  415.   do forever
  416.     call PutCopyright 'Setup'
  417.     say '    1. Download Path               ('INIVar.14.Val')'
  418.     say '    2. Upload Path                 ('INIVar.15.Val')'
  419.     say '    3. Download Priority           ('INIVar.16.Val')'
  420.     say '    4. Upload Priority             ('INIVar.17.Val')'
  421.     say '    5. Automatic ZModem Start      ('INIVar.18.Val')'
  422.     say '    6. Name Collision on Download  ('INIVar.19.Val')'
  423.     say '    0. Exit Protocol Settings'
  424.     say ''
  425.     call charout ,'Enter 0, 1, 2, 3, 4, 5, or 6: '
  426.     do forever
  427.       k = SysGetKey('NOECHO')
  428.       if k = '0' | k = '1' | k = '2' | k = '3' | k = '4' | k = '5' | k = '6' | k = D2C(27) then
  429.         do
  430.           if k = D2C(27) then k = '0'
  431.           say k
  432.           ProtoAction = k
  433.           leave
  434.         end
  435.       else
  436.         call beep 1760, 50
  437.     end
  438.     select
  439.       when ProtoAction = '0' then leave
  440.       when ProtoAction = '1' then
  441.         do
  442.           call AskPath2 'Enter Download Path: ', INIVar.14.Val, 'CREATE'
  443.           if result \= '' then INIVar.14.Val = result
  444.           if INIVar.14.Val = 'nul' then INIVar.14.Val = ''
  445.         end
  446.       when ProtoAction = '2' then
  447.         do
  448.           call AskPath2 'Enter Upload Path: ', INIVar.15.Val, 'CREATE'
  449.           if result \= '' then INIVar.15.Val = result
  450.           if INIVar.15.Val = 'nul' then INIVar.15.Val = ''
  451.         end
  452.       when ProtoAction = '5' then
  453.         do
  454.           if INIVar.18.Val = 'TRUE' then
  455.             INIVar.18.Val = 'FALSE'
  456.           else
  457.             INIVar.18.Val = 'TRUE'
  458.         end
  459.       when ProtoAction = '6' then
  460.         do
  461.           call PutCopyright 'Setup'
  462.           say 'Name Collision on Download (Current is:' INIVar.19.Val')'
  463.           say ''
  464.           say '    1. SALVAGE (rename existing file)'
  465.           say '    2. TRUE    (overwrite existing file)'
  466.           say '    3. FALSE   (fail is file exists)'
  467.           say '    0. No change'
  468.           say ''
  469.           say ''
  470.           call charout ,'Enter 0, 1, 2, or 3: '
  471.           do forever
  472.             k = SysGetKey('NOECHO')
  473.             if k = '0' | k = '1' | k = '2' | k = '3' | k = D2C(27) then
  474.               do
  475.                 if k = D2C(27) then k = '0'
  476.                 say k
  477.                 ProtoAction1 = k
  478.                 leave
  479.               end
  480.             else
  481.               call beep 1760, 50
  482.           end
  483.           select
  484.             when ProtoAction1 = '1' then INIVar.19.Val = 'SALVAGE'
  485.             when ProtoAction1 = '2' then INIVar.19.Val = 'TRUE'
  486.             when ProtoAction1 = '3' then INIVar.19.Val = 'FALSE'
  487.             otherwise nop
  488.           end
  489.         end
  490.       otherwise
  491.         do
  492.           pa = ProtoAction + 13
  493.           call PutCopyright 'Setup'
  494.           if pa = 16 then
  495.             say 'Download Priority Class (Current is:' INIVar.16.Val')'
  496.           else
  497.             say 'Upload Priority Class (Current is:' INIVar.17.Val')'
  498.           say ''
  499.           say '    1. IDLE'
  500.           say '    2. NORMAL'
  501.           say '    3. FIXEDHIGH'
  502.           say '    4. TIMECRITICAL'
  503.           say '    0. No change'
  504.           say ''
  505.           say ''
  506.           call charout ,'Enter 0, 1, 2, 3, or 4: '
  507.           do forever
  508.             k = SysGetKey('NOECHO')
  509.             if k = '0' | k = '1' | k = '2' | k = '3' | k = '4' | k = D2C(27) then
  510.               do
  511.                 if k = D2C(27) then k = '0'
  512.                 say k
  513.                 ProtoAction1 = k
  514.                 leave
  515.               end
  516.             else
  517.               call beep 1760, 50
  518.           end
  519.           select
  520.             when ProtoAction1 = '1' then INIVar.pa.Val = 'IDLE'
  521.             when ProtoAction1 = '2' then INIVar.pa.Val = 'NORMAL'
  522.             when ProtoAction1 = '3' then INIVar.pa.Val = 'FIXEDHIGH'
  523.             when ProtoAction1 = '4' then INIVar.pa.Val = 'TIMECRITICAL'
  524.             otherwise nop
  525.           end
  526.         end
  527.     end
  528.   end
  529.   return
  530.  
  531. /* ----------------------------------------------------------------------- */
  532.  
  533. MiscSettings:
  534.   do forever
  535.     call PutCopyright 'Setup'
  536.     say '    1. Dialing Directory            ('INIVar.20.Val')'
  537.     say '    2. Function Key Definitions     ('INIVar.21.Val')'
  538.     say '    3. External Program Definitions ('INIVar.22.Val')'
  539.     say '    4. Call Log File                ('INIVar.23.Val')'
  540.     say '    5. Snap Shot File               ('INIVar.24.Val')'
  541.     say '    6. Log File Path                ('INIVar.25.Val')'
  542.     say '    0. Exit File and Path Settings'
  543.     say ''
  544.     call charout ,'Enter 0, 1, 2, 3, 4, 5, or 6: '
  545.     do forever
  546.       k = SysGetKey('NOECHO')
  547.       if k = '0' | k = '1' | k = '2' | k = '3' | k = '4' | k = '5' | k = '6' | k = D2C(27) then
  548.         do
  549.           if k = D2C(27) then k = '0'
  550.           say k
  551.           MiscAction = k
  552.           leave
  553.         end
  554.       else
  555.         call beep 1760, 50
  556.     end
  557.     select
  558.       when MiscAction = '0' then leave
  559.       when MiscAction = '6' then
  560.         do
  561.           call AskPath2 'Enter Log File Path: ', INIVar.25.Val, 'CREATE'
  562.           if result \= '' then INIVar.25.Val = result
  563.           if INIVar.25.Val = 'nul' then INIVar.25.Val = ''
  564.         end
  565.       otherwise
  566.         do
  567.           ma = MiscAction + 19
  568.           say ''
  569.           select
  570.             when ma = 20 then say 'Enter Dialing Directory File Name'
  571.             when ma = 21 then say 'Enter Function Key definition File Name'
  572.             when ma = 22 then say 'Enter External Program Definition File Name'
  573.             when ma = 23 then say 'Enter Call Log File Name'
  574.             when ma = 24 then say 'Enter Snap Shot File Name'
  575.           end
  576.           say 'Current value is "'INIVar.ma.Val'", press ENTER to leave unchanged or'
  577.           call charout ,'type new value: '
  578.           r = linein('stdin')
  579.           if length(r) \= 0 then INIVar.ma.val = r
  580.         end
  581.     end
  582.   end
  583.   return
  584.  
  585. /* ----------------------------------------------------------------------- */
  586.  
  587. AskPath:
  588. parse arg apType
  589.   cwd = directory()
  590.   do forever
  591.     call SysCls
  592.     say 'Select' apType 'Path'
  593.     say ''
  594.     say 'Current setting is:'
  595.     if apType = 'SOURCE' then
  596.       say '    ' SourcePath
  597.     else
  598.       say '    ' TargetPath
  599.     say ''
  600.     call charout ,'Enter new setting (press ENTER to leave unchanged): '
  601.     np = linein('stdin')
  602.     np = strip(np, 'B')
  603.     if length(np) = 0 then
  604.       leave
  605.     else
  606.       do
  607.         if substr(np, length(np), 1) = '\' then
  608.           do
  609.             if (np = '\') | (length(np) = 3 & substr(np, 2, 1) = ':') then
  610.               nop
  611.             else
  612.               np = substr(np, 1, length(np) - 1)
  613.           end
  614.         if np = '..' & length(cwd) > 3 then
  615.           do
  616.             temp = reverse(cwd)
  617.             temp = substr(temp, pos('\', temp)+1)
  618.             np = reverse(temp)
  619.           end
  620.         if np = '.' then np = cwd
  621.         if substr(np, 2, 1) \= ':' then
  622.           do
  623.             if substr(np, 1, 1) = '\' then
  624.               np = substr(cwd, 1, 2) || np
  625.             else
  626.               np = cwd || '\' || np
  627.           end
  628.         if pos(translate(substr(np, 1, 2)), AvailDrives) = 0 then
  629.           do
  630.             call beep 1760, 50
  631.             say ''
  632.             say 'Invalid drive letter "'substr(np, 1, 2)'"'
  633.             call charout ,'Press any key...'
  634.             call SysGetKey 'NOECHO'
  635.           end
  636.         else
  637.           do
  638.             testnp = directory(np)
  639.             if translate(testnp) = translate(np) then
  640.               do
  641.                 call directory cwd
  642.                 if apType = 'SOURCE' then
  643.                   SourcePath = testnp
  644.                 else
  645.                   TargetPath = testnp
  646.                 leave
  647.               end
  648.             else
  649.               do
  650.                 call beep 1760, 50
  651.                 say ''
  652.                 say 'Directory path "'np'" does not exist!'
  653.                 if apType = 'SOURCE' then
  654.                   do
  655.                     call charout ,'Press any key...'
  656.                     call SysGetKey 'NOECHO'
  657.                   end
  658.                 else
  659.                   do
  660.                     call GetYN 'Create it?'
  661.                     if result = '1' then
  662.                       do
  663.                         r = SysMkDir(np)
  664.                         if r = 0 then
  665.                           do
  666.                             testnp = directory(np)
  667.                             call directory cwd
  668.                             if apType = 'SOURCE' then
  669.                               SourcePath = testnp
  670.                             else
  671.                               TargetPath = testnp
  672.                             leave
  673.                           end
  674.                         else
  675.                           do
  676.                             say 'Cannot create directory "'np'"'
  677.                             call charout, 'Press any key...'
  678.                             call SysGetKey 'NOECHO'
  679.                           end
  680.                       end
  681.                   end
  682.               end
  683.           end
  684.       end
  685.   end
  686.   return
  687.  
  688.  
  689. AskPath2:
  690. parse arg ap2Prompt, ap2Current, ap2Flag
  691.   cwd = directory()
  692.   do forever
  693.     say ap2Prompt
  694.     say ''
  695.     say 'Current setting is:' ap2Current
  696.     say ''
  697.     if ap2Flag = 'MUSTEXIST' then
  698.       say 'Enter new setting (press ENTER to leave unchanged)'
  699.     else
  700.       say 'Enter new setting (press ENTER to leave unchanged, type "NUL" to clear)'
  701.       call charout ,'> '
  702.     np = linein('stdin')
  703.     np = strip(np, 'B')
  704.     testnp = ''
  705.     if length(np) = 0 then
  706.       leave
  707.     else
  708.       do
  709.         if substr(np, length(np), 1) = '\' then
  710.           do
  711.             if (np = '\') | (length(np) = 3 & substr(np, 2, 1) = ':') then
  712.               nop
  713.             else
  714.               np = substr(np, 1, length(np) - 1)
  715.           end
  716.         if np = '..' & length(cwd) > 3 then
  717.           do
  718.             temp = reverse(cwd)
  719.             temp = substr(temp, pos('\', temp)+1)
  720.             np = reverse(temp)
  721.           end
  722.         if np = '.' then np = cwd
  723.         if translate(np) = 'NUL' then
  724.           do
  725.             testnp = 'nul'
  726.             leave
  727.           end
  728.         if substr(np, 2, 1) \= ':' then
  729.           do
  730.             if substr(np, 1, 1) = '\' then
  731.               np = substr(cwd, 1, 2) || np
  732.             else
  733.               np = cwd || '\' || np
  734.           end
  735.         if pos(translate(substr(np, 1, 2)), AvailDrives) = 0 then
  736.           do
  737.             call beep 1760, 50
  738.             say ''
  739.             say 'Invalid drive letter "'substr(np, 1, 2)'"'
  740.             call charout ,'Press any key...'
  741.             call SysGetKey 'NOECHO'
  742.             say ''
  743.           end
  744.         else
  745.           do
  746.             testnp = directory(np)
  747.             if translate(testnp) = translate(np) then
  748.               do
  749.                 call directory cwd
  750.                 leave
  751.               end
  752.             else
  753.               do
  754.                 call beep 1760, 50
  755.                 say ''
  756.                 say 'Directory path "'np'" does not exist!'
  757.                 if ap2Flag \= 'CREATE' then
  758.                   do
  759.                     call charout ,'Press any key...'
  760.                     call SysGetKey 'NOECHO'
  761.                     testnp = ''
  762.                     say ''
  763.                   end
  764.                 else
  765.                   do
  766.                     call GetYN 'Create it?'
  767.                     if result = '1' then
  768.                       do
  769.                         r = SysMkDir(np)
  770.                         if r = 0 then
  771.                           do
  772.                             testnp = directory(np)
  773.                             call directory cwd
  774.                             leave
  775.                           end
  776.                         else
  777.                           do
  778.                             say 'Cannot create directory "'np'"'
  779.                             call charout, 'Press any key...'
  780.                             call SysGetKey 'NOECHO'
  781.                             testnp = ''
  782.                             say ''
  783.                           end
  784.                       end
  785.                     else
  786.                       testnp = ''
  787.                   end
  788.               end
  789.           end
  790.       end
  791.   end
  792.   return testnp
  793.  
  794.  
  795. /* ----------------------------------------------------------------------- */
  796.  
  797. GetBootDrive: /* procedure expose BootDrive AvailDrives DLLPath LIBSubPath */
  798.   gbdRC = -1
  799.   do while gbdRC = -1
  800.     call PutCopyright 'Full'
  801.     say '    Please enter the drive letter for your boot drive.'
  802.     call charout ,'    Press the letter for the drive or ESC to quit: '
  803.     do forever
  804.       k = translate(SysGetKey('NOECHO'))
  805.       if k = D2C(27) then
  806.         do
  807.           gbdRC = 0
  808.           leave
  809.         end
  810.       else
  811.         do
  812.           if k = D2C(13) then k = 'C'
  813.           k = k||':'
  814.           if pos(k, AvailDrives) = 0 then
  815.             call beep 1760, 50
  816.           else
  817.             do
  818.               call SysFileTree k||'\Config.Sys', 'foo', 'F'
  819.               if foo.0 = 0 then
  820.                 do
  821.                   say ''
  822.                   say 'Cannot locate file "'k'\Config.Sys"'
  823.                   call charout ,'Press any key...'
  824.                   call SysGetKey 'NOECHO'
  825.                   leave
  826.                 end
  827.               else
  828.                 do
  829.                   BootDrive = k
  830.                   call GetLIBPath
  831.                   gbdRC = 1
  832.                   leave
  833.                 end
  834.             end
  835.         end
  836.     end
  837.   end
  838.   return gbdRC
  839.  
  840.  
  841. /* ----------------------------------------------------------------------- */
  842.  
  843. GetLIBPATH: /* procedure expose BootDrive DLLPath LIBSubPath */
  844.   srchRC = SysFileSearch('LIBPATH=', BootDrive||'\Config.Sys', 'lpath')
  845.   if srchRC = 0 then
  846.     do i = 1 to lpath.0
  847.       if translate(substr(lpath.i, 1, 8)) = 'LIBPATH=' then
  848.         do
  849.           j = 0
  850.           temp = substr(lpath.i, 9)
  851.           do while length(temp) > 0
  852.             parse var temp tpath ';' temp
  853.             j = j + 1
  854.             if tpath = '.' then
  855.               do
  856.                 LIBSubPath.j = '*Program Directory*'
  857.                 DLLPath = LIBSubPath.j
  858.               end
  859.             else
  860.               LIBSubPath.j = tpath
  861.           end
  862.           LIBSubPath.0 = j
  863.           if DLLPath = '' then DLLPath = LIBSubPath.1
  864.         end
  865.     end
  866.   return
  867.  
  868.  
  869. AskLIBPath: /* procedure expose BootDrive DLLPath LIBSubPath */
  870.   if LIBSubPath.0 > 0 then
  871.     do
  872.       j = 0
  873.       i = 0
  874.       lpSelect = 0
  875.       topval   = 1
  876.       call PutCopyright 'Install'
  877.       say "    Please select a path for TE/2's associated DLL file to be placed"
  878.       say '    from the following list of paths in your LIBPATH:'
  879.       say ''
  880.       do forever
  881.         i = i + 1
  882.         j = j + 1
  883.         say '    ' D2C(j+64)':' LIBSubPath.i
  884.         if j = 10 | i = LIBSubPath.0 then
  885.           do
  886.             topkey = D2C(j+C2D('A')-1)
  887.             say ''
  888.             call charout ,' -- A-'topkey'=Select, R=restart, Q (or ESC)=exit, any other key=more --'
  889.             k = C2D(translate(SysGetKey('NOECHO')))
  890.             if k = 27 then k = C2D('Q')
  891.             if k = C2D('Q') then leave
  892.             if k = C2D('R') then
  893.               do
  894.                 i = 0
  895.                 j = 0
  896.                 topval = 1
  897.               end
  898.             else
  899.               do
  900.                 topkey = j+C2D('A')
  901.                 if k > C2D('@') & k < topkey then
  902.                   do
  903.                     lpSelect = topval + (k - C2D('A'))
  904.                     DLLPath = LIBSubPath.lpSelect
  905.                     leave
  906.                   end
  907.                 j = 0
  908.                 if i = LIBSubPath.0 then i = 0
  909.                 topval = i + 1
  910.                 call PutCopyright 'Install'
  911.                 say "    Please select a path for TE/2's associated DLL file to be placed"
  912.                 say '    from the following list of paths in your LIBPATH:'
  913.                 say ''
  914.               end
  915.           end
  916.       end
  917.     end
  918.   return
  919.  
  920.  
  921. /* ----------------------------------------------------------------------- */
  922.  
  923. AskDLL16:
  924.   call PutCopyright 'Install'
  925.   say 'TE/2 comes supplied with a 16-bit version of its COMMPAK2.DLL file'
  926.   say 'which is compatible with OS/2 1.x and OS/2 2.x and with a 32-bit'
  927.   say 'version which is only compatible with OS/2 2.x.  You currently have'
  928.   say 'selected the' tempDLL16 'version.'
  929.   say ''
  930.   call GetYN 'Do you want to change to the other version?'
  931.   if result then
  932.     do
  933.       if DLL16Bit = 0 then
  934.         DLL16Bit = 1
  935.       else
  936.         DLL16Bit = 0
  937.     end
  938.   return
  939.  
  940. /* ----------------------------------------------------------------------- */
  941.  
  942. DoInstall:
  943.   call PutCopyright 'Install'
  944.   say 'PLEASE NOTE: If you are installing over an existing TE/2 installation'
  945.   say 'you should make sure that you have made a BACKUP of your current'
  946.   say 'setup!  This install procedure will attempt to protect your files'
  947.   say 'which are user customizable (TE2.INI for example) but, for your'
  948.   say 'protection and peace of mind, a good backup is highly recommended!'
  949.   say ''
  950.   call GetYN 'Do you want to continue with the installation at this time?'
  951.   if result = 1 then
  952.     do
  953.       pathOK = 1
  954.       cwd = directory()
  955.       testpath = directory(TargetPath)
  956.       call directory cwd
  957.       if translate(testpath) \= translate(TargetPath) then
  958.         do
  959.           say ''
  960.           say 'Target path "'TargetPath'" does not exist!'
  961.           call GetYN 'Create it?'
  962.           if result = '1' then
  963.             do
  964.               r = SysMkDir(TargetPath)
  965.               if r \= 0 then
  966.                 do
  967.                   say 'Cannot create directory "'TargetPath'"'
  968.                   call charout ,'Press any key...'
  969.                   call SysGetKey 'NOECHO'
  970.                   pathOK = 0
  971.                 end
  972.             end
  973.           else
  974.             pathOK = 0
  975.         end
  976.       if pathOK = 0 then return
  977.  
  978.       tempSrc = SourcePath
  979.       n = length(tempSrc)
  980.       if substr(tempSrc, n, 1) \= '\' then tempSrc = tempSrc||'\'
  981.       tempDest = TargetPath
  982.       n = length(tempDest)
  983.       if substr(tempDest, n, 1) \= '\' then tempDest = tempDest||'\'
  984.       r1 = stream(tempSrc||InstDat01, 'C', 'query exists')
  985.       r2 = stream(tempSrc||InstDat02, 'C', 'query exists')
  986.       if r1 = '' | r2 = '' then
  987.         do
  988.           call beep 1760, 50
  989.           say ''
  990.           say ''
  991.           say 'Install cannot locate one or both of the installation data files:'
  992.           say Instdat01 'and/or' InstDat02 'in the directory you specified as'
  993.           say 'the source path ('SourcePath').  Please correct this situation'
  994.           say 'before you continue.'
  995.           say ''
  996.           call charout ,'Press any key...'
  997.           call SysGetKey 'NOECHO'
  998.         end
  999.       else
  1000.         do
  1001.           do i = 1 to Sensitive.0
  1002.             r = stream(tempDest||Sensitive.i, 'C', 'query exists')
  1003.             if r \= '' then
  1004.               do
  1005.                 call PutCopyright 'Install'
  1006.                 say 'NOTE:'
  1007.                 say ''
  1008.                 say 'The file:' Sensitive.i 'already exists in the target path!'
  1009.                 say 'Select:'
  1010.                 say '       1. Skip file (do not overwrite)'
  1011.                 say '       2. Rename to' Sensitive.i.Backup 'and copy new file.'
  1012.                 say '       3. Overwrite the file with the new version'
  1013.                 say ''
  1014.                 call charout ,'Enter 1, 2, or 3: '
  1015.                 do forever
  1016.                   k = SysGetKey('NOECHO')
  1017.                   if k = '1' | k = '2' | k = '3' then
  1018.                       leave
  1019.                   else
  1020.                     call beep 1760, 50
  1021.                 end
  1022.                 say k
  1023.                 if k = '2' then
  1024.                   'copy' tempDest||Sensitive.i tempDest||Sensitive.i.Backup
  1025.                 if k \= '1' then
  1026.                   Sensitive.param = Sensitive.i||' '||Sensitive.param
  1027.               end
  1028.             else
  1029.               Sensitive.param = Sensitive.i||' '||Sensitive.param
  1030.           end
  1031.  
  1032.           cwd = directory()
  1033.           call directory TargetPath
  1034.  
  1035.           'ren' tempSrc||InstDat01 'TE2Inst1.EXE'
  1036.           call PutCopyright 'Install'
  1037.           say 'Installing from:' SourcePath '-->' targetPath
  1038.           say ''
  1039.           tempSrc||'Te2Inst1 * /o'
  1040.           'ren' tempSrc||'Te2Inst1.EXE' InstDat01
  1041.  
  1042.           if Sensitive.param \= '' then
  1043.             do
  1044.               'ren' tempSrc||InstDat02 'TE2Inst2.EXE'
  1045.               call PutCopyright 'Install'
  1046.               say 'Installing from:' SourcePath '-->' targetPath
  1047.               say ''
  1048.               tempSrc||'TE2Inst2' Sensitive.param '/o'
  1049.               'ren' tempSrc||'TE2Inst2.EXE' InstDat02
  1050.             end
  1051.  
  1052.           say 'Copying remaining files...'
  1053.           'copy' tempSrc||'Te2Setup.CMD'  TargetPath
  1054.           'copy' tempSrc||'Oberon.ICO' TargetPath
  1055.  
  1056.           if DLL16Bit = 1 then
  1057.             do
  1058.               say ''
  1059.               say 'Configuring for 16-bit DLL...'
  1060.               'ren COMMPAK2.DLL CPK2_32.DLL'
  1061.               'ren CPK2_16.DLL COMMPAK2.DLL'
  1062.             end
  1063.  
  1064.           if DLLPath \= '*Program Directory*' then
  1065.             do
  1066.               say ''
  1067.               say 'Copying COMMPAK2.DLL to' DLLPath'...'
  1068.               'copy Commpak2.DLL' DLLPath
  1069.             end
  1070.  
  1071.           call directory cwd
  1072.           call PutCopyright 'Install'
  1073.           say '    Installation of files is complete!'
  1074.           say ''
  1075.           say ''
  1076.           say 'If you wish, Install can create a desktop folder containing TE/2'
  1077.           say 'program and information objects for you.'
  1078.           say ''
  1079.           call GetYN 'Do you want a desktop folder installed?'
  1080.           if result = 1 then call CreateFolder
  1081.  
  1082.           call PutCopyright 'Install'
  1083.           say '    Installation of files is complete!'
  1084.           say ''
  1085.           say ''
  1086.           call charout ,'Press any key...'
  1087.           call SysGetKey 'NOECHO'
  1088.  
  1089.           InstallDone = 1
  1090.           TargetPath2 = TargetPath
  1091.  
  1092.         end
  1093.     end
  1094.   return
  1095.  
  1096. /* ----------------------------------------------------------------------- */
  1097.  
  1098. CreateFolder:
  1099.   call PutCopyright 'Install'
  1100.  
  1101.   classname='WPFolder'
  1102.   title='Oberon Software'
  1103.   location='<WP_DESKTOP>'
  1104.   setup='OBJECTID=<OBERON_FOLDER>;'||,
  1105.         'ICONFILE='tempDest'Oberon.ico;'||,
  1106.         'ICONPOS=25,75;'||,
  1107.         'OPEN=ICON;'
  1108.   option='U'
  1109.   call BldObj
  1110.  
  1111.   classname='WPProgram'
  1112.   title='TE/2^Windowed Session'
  1113.   location='<OBERON_FOLDER>'
  1114.   setup='OBJECTID=<OBERON_TE2>;'||,
  1115.         'EXENAME='tempDest'TE2.EXE;'||,
  1116.         'PARAMETERS=-fTe2.ini;'||,
  1117.         'STARTUPDIR='TargetPath';'||,
  1118.         'PROGTYPE=WINDOWABLEVIO;'
  1119.   option='R'
  1120.   call BldObj
  1121.  
  1122.   classname='WPProgram'
  1123.   title='TE/2 Setup'
  1124.   location='<OBERON_FOLDER>'
  1125.   setup='OBJECTID=<OBERON_TE2SETUP>;'||,
  1126.         'EXENAME='tempDest'TE2SETUP.CMD;'||,
  1127.         'STARTUPDIR='TargetPath';'||,
  1128.         'PROGTYPE=WINDOWABLEVIO;'
  1129.   option='R'
  1130.   call BldObj
  1131.  
  1132.   classname='WPProgram'
  1133.   title='TE/2 User Manual'
  1134.   location='<OBERON_FOLDER>'
  1135.   setup='OBJECTID=<OBERON_TE2DOC>;'||,
  1136.         'EXENAME=VIEW.EXE;'||,
  1137.         'PARAMETERS=TE2;'||,
  1138.         'STARTUPDIR='TargetPath';'||,
  1139.         'PROGTYPE=PM;'
  1140.   option='R'
  1141.   call BldObj
  1142.  
  1143.   classname='WPShadow'
  1144.   title='WHATS.NEW'
  1145.   location='<OBERON_FOLDER>'
  1146.   setup='SHADOWID='||tempDest||'WHATS.NEW;'
  1147.   option='R'
  1148.   call BldObj
  1149.  
  1150.   classname='WPShadow'
  1151.   title='ORDER FORM'
  1152.   location='<OBERON_FOLDER>'
  1153.   setup='SHADOWID='||tempDest||'ORDER.FRM;'
  1154.   option='R'
  1155.   call BldObj
  1156.  
  1157.   return
  1158.  
  1159.  
  1160. BldObj:
  1161.   call charout ,'    Building:' title '... '
  1162.   r = SysCreateObject(classname, title, location, setup, option)
  1163.   if r = 1 then
  1164.     say 'Object created!'
  1165.   else
  1166.     say 'Not created!  Return code='r
  1167.   return
  1168.  
  1169.  
  1170. /* ----------------------------------------------------------------------- */
  1171.  
  1172. CheckINIFile:
  1173.   rval = 0
  1174.   if TargetPath2 = '' then
  1175.     TargetPath2 = directory()
  1176.  
  1177.   n = length(TargetPath2)
  1178.   if substr(TargetPath2, n, 1) = '\' then
  1179.     testfn = TargetPath2||'TE2.INI'
  1180.   else
  1181.     testfn = TargetPath2||'\TE2.INI'
  1182.  
  1183.   r = stream(testfn, 'C', 'query exists')
  1184.   if r = '' then
  1185.     do forever
  1186.       call PutCopyright 'Setup'
  1187.       say 'Setup cannot locate the TE2.INI file.'
  1188.       say ''
  1189.       call AskPath2 'Please specify the path to your TE/2 installation', TargetPath2, 'MUSTEXIST'
  1190.       testfn = result
  1191.       if testfn \= '' then
  1192.         do
  1193.           TargetPath2 = testfn
  1194.           n = length(testfn)
  1195.           if substr(testfn, n, 1) = '\' then
  1196.             testfn = testfn||'TE2.INI'
  1197.           else
  1198.             testfn = testfn||'\TE2.INI'
  1199.           r = stream(testfn, 'C', 'query exists')
  1200.           if r \= '' then
  1201.             do
  1202.               RestorePath = directory()
  1203.               call directory TargetPath2
  1204.               INIFileName = testfn
  1205.               rval = 1
  1206.               leave
  1207.             end
  1208.         end
  1209.       else
  1210.         leave
  1211.     end
  1212.   else
  1213.     do
  1214.       RestorePath = directory()
  1215.       call directory TargetPath2
  1216.       INIFileName = testfn
  1217.       rval = 1
  1218.     end
  1219.   return rval
  1220.  
  1221. /* ----------------------------------------------------------------------- */
  1222.  
  1223. GetINISettings:
  1224.   say ''
  1225.   call charout ,'Reading:' INIFileName'...'
  1226.   srchTemp. = ''
  1227.   srchRC = SysFileSearch('Device', INIFileName, 'srchTemp')
  1228.   if srchRC = 0 then
  1229.     do i = 1 to srchTemp.0
  1230.       if translate(substr(strip(srchTemp.i, 'L'), 1, 6)) = 'DEVICE' then
  1231.         do
  1232.           parse var srchTemp.i dummy1 TE2Device dummy2
  1233.           leave
  1234.         end
  1235.     end
  1236.   if TE2Device = '' then
  1237.     TE2Device = 'COM1'
  1238.  
  1239.   r = stream('MODEM.INC', 'C', 'open read')
  1240.   TE2Modem = substr(linein('MODEM.INC'), 3)
  1241.   r = stream('MODEM.INC', 'C', 'close')
  1242.   if TE2Modem = '' then
  1243.     TE2Modem = 'Generic 2400 baud'
  1244.  
  1245.   do i = 1 to INIVar.0
  1246.     srchTemp. = ''
  1247.     srchRC = SysFileSearch(INIVar.i, INIFileName, 'srchTemp')
  1248.     if srchRC = 0 then
  1249.       do j = 1 to srchTemp.0
  1250.         if translate(substr(strip(srchTemp.j, 'L'), 1, length(INIVar.i))) = translate(INIVar.i) then
  1251.           do
  1252.             parse var srchTemp.j dummy1 INIVar.i.Val dummy2
  1253.             if substr(INIVar.i.Val, 1, 1) = ';' then INIVar.i.Val = ''
  1254.             leave
  1255.           end
  1256.       end
  1257.   end
  1258.  
  1259.   say ' Done!'
  1260.   return
  1261.  
  1262. /* ----------------------------------------------------------------------- */
  1263.  
  1264. SaveINIFile:
  1265.   say ''
  1266.   call charout ,'Saving values to:' INIFileName'...'
  1267.  
  1268.   inputfile  = INIFileName
  1269.   n = length(TargetPath2)
  1270.   if substr(TargetPath2, n, 1) = '\' then
  1271.     do
  1272.       outputfile = TargetPath2||'TEMPINI.$$$'
  1273.       backupfile = TargetPath2||'TE2INI.BAK'
  1274.     end
  1275.   else
  1276.     do
  1277.       outputfile = TargetPath2||'\TEMPINI.$$$'
  1278.       backupfile = TargetPath2||'\TE2INI.BAK'
  1279.     end
  1280.  
  1281.   call SysFileDelete outputfile
  1282.   r = stream(inputfile,  'C', 'open read')
  1283.   r = stream(outputfile, 'C', 'open write')
  1284.   do while lines(inputfile)
  1285.     aline = linein(inputfile)
  1286.     parse var aline keywd keyval
  1287.     test = translate(strip(keywd))
  1288.     if test = 'DEVICE' then
  1289.       aline = 'Device  '||TE2Device
  1290.     else
  1291.       do i = 1 to INIVar.0
  1292.         if test = translate(INIVar.i) then
  1293.           do
  1294.             if length(INIVar.i.val) > 0 then
  1295.               aline = INIVar.i||'  '||INIVar.i.Val
  1296.             else
  1297.               aline = INIVar.i||'  ;'
  1298.             INIVar.i.Written = 'Y'
  1299.             leave
  1300.           end
  1301.       end
  1302.     call lineout outputfile, aline
  1303.   end
  1304.  
  1305.   do i = 1 to INIVar.0
  1306.     if INIVar.i.Written \= 'Y' then
  1307.       do
  1308.         if length(INIVar.i.val) > 0 then
  1309.           aline = INIVar.i||'  '||INIVar.i.Val
  1310.         else
  1311.           aline = INIVar.i||'  ;'
  1312.         call lineout outputfile, aline
  1313.       end
  1314.     INIVar.i.Written = ''
  1315.   end
  1316.  
  1317.   r = stream(inputfile,  'C', 'close')
  1318.   r = stream(outputfile, 'C', 'close')
  1319.   call SysFileDelete backupfile
  1320.   'ren' inputfile 'TE2INI.BAK'
  1321.   'ren' outputfile 'TE2.INI'
  1322.  
  1323.   say ' Done!'
  1324.   return
  1325.  
  1326. /* ----------------------------------------------------------------------- */
  1327.  
  1328. SelectDevice:
  1329.   do forever
  1330.     call PutCopyright 'Setup'
  1331.     say 'Please enter the name of the COM device you wish to use with TE/2'
  1332.     say '(i.e., COM1, COM2, etc.).  You may just press ENTER if you want to'
  1333.     say 'use' TE2Device'.'
  1334.     say ''
  1335.     call charout ,'Enter device name: '
  1336.     tempDevice = strip(linein('stdin'), 'B')
  1337.     if tempDevice = '' then tempDevice = TE2Device
  1338.     say ''
  1339.     say 'You selected:' tempDevice
  1340.     call charout ,'Press Y to confirm or any other key to retype the name...'
  1341.     if translate(SysGetKey('NOECHO')) = 'Y' then
  1342.      do
  1343.        TE2Device = tempDevice
  1344.        leave
  1345.      end
  1346.     say ''
  1347.     say ''
  1348.   end
  1349.   return
  1350.  
  1351. /* ----------------------------------------------------------------------- */
  1352.  
  1353. SelectModem:
  1354.  
  1355.   if ModemFile.0 = '' then
  1356.     do
  1357.       call PutCopyright 'Setup'
  1358.       call charout ,'Reading Modem files...'
  1359.  
  1360.       n = length(TargetPath2)
  1361.       if substr(targetPath2, n, 1) = '\' then
  1362.         tempPath = TargetPath2
  1363.       else
  1364.         tempPath = TargetPath2||'\'
  1365.  
  1366.       call SysFileTree tempPath'MODEMS\*.INC', 'ModemFile', 'F'
  1367.     end
  1368.  
  1369.   sftFNStart = 38      /* Where the actual filename starts in the returned */
  1370.                        /* info from SysFileTree                            */
  1371.  
  1372.   if ModemFile.0 > 0 then
  1373.     do
  1374.       call PutCopyright 'Setup'
  1375.       j = 0
  1376.       ModemSelect = 0
  1377.       topval = 1
  1378.       i = 0
  1379.  
  1380.       do forever
  1381.         i = i + 1
  1382.         j = j + 1
  1383.  
  1384.         if ModemFile.i.Desc = '' then
  1385.           do
  1386.             ModemFile.i = substr(ModemFile.i, sftFNStart)
  1387.             r = stream(ModemFile.i, 'C', 'open read')
  1388.             ModemFile.i.Desc = linein(ModemFile.i)
  1389.             r = stream(ModemFile.i, 'C', 'close')
  1390.           end
  1391.  
  1392.         say D2C(j+64)':' substr(ModemFile.i.Desc, 3)
  1393.  
  1394.         if (j = 10) | (i = ModemFile.0) then
  1395.           do
  1396.             topkey = D2C(j+C2D('A')-1)
  1397.             say ''
  1398.             call charout ,'  -- Press A-'topkey' to select, R to start over, Q to exit, SPACE to continue --'
  1399.             k = C2D(translate(SysGetKey('NOECHO')))
  1400.             if k = 27 then k = C2D('Q')
  1401.             if k = C2D('Q') then leave
  1402.             if k = C2D('R') then
  1403.               do
  1404.                 i = 0
  1405.                 j = 0
  1406.                 topval = 1
  1407.                 call PutCopyright 'Setup'
  1408.               end
  1409.             else
  1410.               do
  1411.                 topkey = j+C2D('A')
  1412.                 if (k > C2D('@')) & (k < topkey) then
  1413.                   do
  1414.                     ModemSelect = topval + (k - C2D('A'))
  1415.                     say ''
  1416.                     say 'Select:' substr(ModemFile.ModemSelect.Desc, 3)||'?'
  1417.                     call charout ,'Press Y to confirm, any other key to continue...'
  1418.                     k = translate(SysGetKey('NOECHO'))
  1419.                     if k = 'Y' then leave
  1420.                   end
  1421.                 call PutCopyright 'Setup'
  1422.                 j = 0
  1423.                 if i = ModemFile.0 then i = 0
  1424.                 topval = i + 1
  1425.               end
  1426.           end
  1427.       end
  1428.  
  1429.       if ModemSelect \= 0 then
  1430.         do
  1431.           call SysCls
  1432.           TE2Modem = substr(ModemFile.ModemSelect.Desc, 3)
  1433.           say 'You selected:' substr(ModemFile.ModemSelect.Desc, 3)
  1434.           say ''
  1435.           say 'You may need to perform a one-time modem setup for this modem.'
  1436.           say 'Here are the comments from the modem configuration file (these'
  1437.           say 'comments may be found later in the file MODEM.INC in your TE/2'
  1438.           say 'directory).'
  1439.           say ''
  1440.           call charout ,'Press any key to view comments...'
  1441.           call SysGetKey 'NOECHO'
  1442.           call SysCls
  1443.           r = stream(ModemFile.ModemSelect, 'C', 'open read')
  1444.           do forever
  1445.             aline = linein(ModemFile.ModemSelect)
  1446.             if substr(aline, 1, 1) \= ';' then leave
  1447.             say substr(aline, 2)
  1448.           end
  1449.           r = stream(ModemFile.ModemSelect, 'C', 'close')
  1450.           say ''
  1451.           say 'Copying' ModemFile.ModemSelect 'to' tempPath'MODEM.INC.'
  1452.           'copy' ModemFile.ModemSelect tempPath'MODEM.INC.'
  1453.           call charout ,'Press any key to continue...'
  1454.           call SysGetKey 'NOECHO'
  1455.         end
  1456.     end
  1457.   else
  1458.     do
  1459.       say '  No Modem Files Found!'
  1460.       say ''
  1461.       call charout ,'Press any key to continue...'
  1462.       call SysGetKey 'NOECHO'
  1463.     end
  1464.  
  1465.   return
  1466.  
  1467.  
  1468. /* ----------------------------------------------------------------------- */
  1469.  
  1470. SetupColors:
  1471.   r = stream('te2color.exe', 'C', 'query exists')
  1472.   if r = '' then
  1473.     do
  1474.       call PutCopyright 'Setup'
  1475.       say 'The TE/2 color setup program, TE2Color.EXE cannot be found!'
  1476.       say ''
  1477.       call charout ,'Press any key...'
  1478.       call SysGetKey 'NOECHO'
  1479.     end
  1480.   else
  1481.     'te2color' INIFileName
  1482.   return
  1483.  
  1484. /* ----------------------------------------------------------------------- */
  1485.  
  1486. PutCopyright:
  1487. parse arg crType
  1488.   call SysCls
  1489.   select
  1490.     when crType = 'Install' then say CopyRILine0
  1491.     when crType = 'Setup'   then say CopyRCLine0
  1492.     otherwise                    say CopyRLine0
  1493.   end
  1494.   say CopyRLine1
  1495.   say CopyRLine2
  1496.   say ''
  1497.   say ''
  1498.   return
  1499.  
  1500. /* ----------------------------------------------------------------------- */
  1501.  
  1502. GetYN: procedure
  1503. parse arg gynPrompt
  1504.   call charout ,gynPrompt '(y/N) '
  1505.   do forever
  1506.     k = translate(SysGetKey('NOECHO'))
  1507.     if k = D2C(27) | k = D2C(13) then k = 'N'
  1508.     select
  1509.       when k = 'Y' then
  1510.         do
  1511.           ynRC = 1
  1512.           leave
  1513.         end
  1514.       when k = 'N' then
  1515.         do
  1516.           ynRC = 0
  1517.           leave
  1518.         end
  1519.       otherwise
  1520.         call beep 1760, 50
  1521.     end
  1522.   end
  1523.   return ynRC
  1524.  
  1525. /* ----------------------------------------------------------------------- */
  1526.  
  1527. AskNumber: procedure
  1528. parse arg min, max, prompt
  1529.   rval = ''
  1530.   say ''
  1531.   say 'Press ENTER to leave' prompt 'unchanged or'
  1532.   call charout ,'Type a value between' min 'and' max': '
  1533.   do forever
  1534.     r = linein('stdin')
  1535.     if length(r) = 0 then leave
  1536.     if datatype(r, 'Number') \= 1 then
  1537.       call charout ,'Bad value, try again: '
  1538.     else
  1539.       do
  1540.         if r >= min & r <= max then
  1541.           do
  1542.             rval = r
  1543.             leave
  1544.           end
  1545.         else
  1546.           call charout ,'Out of bounds, try again: '
  1547.       end
  1548.   end
  1549.   return rval
  1550.  
  1551.